package com.junyuan.fxf_pad.activity.fragment;

import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;

import com.junyuan.fxf_pad.R;

public class FaceFragment extends Fragment implements View.OnClickListener {
    ImageButton ibFace_eye_color_plus, ibFace_eye_color_minus,
            ibFace_eye_frequency_plus, ibFace_eye_frequency_minus,
            ibFace_mouth_frequency_plus, ibFace_mouth_frequency_minus;

    ImageView ivFace_eye, ivFace_mouth;
    AnimationDrawable animationDrawable_eye;
    AnimationDrawable animationDrawable_mouth;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_face, null);
        initViews(view);


        return view;

    }


    @Override
    public void onStart() {
        super.onStart();

        ivFace_eye.setBackgroundResource(R.drawable.animator_face_eye);
        animationDrawable_eye = (AnimationDrawable) ivFace_eye.getBackground();
        animationDrawable_eye.start();

        ivFace_mouth.setBackgroundResource(R.drawable.animator_face_mouth);
        animationDrawable_mouth = (AnimationDrawable) ivFace_mouth.getBackground();
        animationDrawable_mouth.start();

    }

    private void initViews(View v) {
        ibFace_eye_color_plus = (ImageButton) v.findViewById(R.id.ibFace_eye_color_plus);
        ibFace_eye_color_minus = (ImageButton) v.findViewById(R.id.ibFace_eye_color_minus);
        ibFace_eye_frequency_plus = (ImageButton) v.findViewById(R.id.ibFace_eye_frequency_plus);
        ibFace_eye_frequency_minus = (ImageButton) v.findViewById(R.id.ibFace_eye_frequency_minus);

        ibFace_mouth_frequency_plus = (ImageButton) v.findViewById(R.id.ibFace_mouth_frequency_plus);
        ibFace_mouth_frequency_minus = (ImageButton) v.findViewById(R.id.ibFace_mouth_frequency_minus);

        ivFace_eye = (ImageView) v.findViewById(R.id.ivFace_eye);
        ivFace_mouth = (ImageView) v.findViewById(R.id.ivFace_mouth);
    }


    @Override
    public void onClick(View v) {

    }
}
